package com.atguigu.lease.web.admin.controller.user;

import com.atguigu.lease.common.result.Result;
import com.atguigu.lease.model.entity.UserCredit;
import com.atguigu.lease.web.admin.service.UserCreditService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/*
*功能：
 作者：chenhao
*日期： 2025/3/15 上午11:24
*/
@Tag(name = "用户信用管理")
@RestController
@RequestMapping("/admin/user/credit")
public class UserCreditController {
    @Autowired
    private UserCreditService userCreditService;

    @Operation(summary = "根据用户id获取用户信用信息")
    @GetMapping("getCreditById/{id}")
    public Result<UserCredit> getCreditById(@PathVariable Long id){
        UserCredit userCredit = userCreditService.getById(id);
        return Result.ok(userCredit);
    }
    @Operation(summary = "更新用户信用信息")
    @PostMapping("updateCreditById")
    public Result<UserCredit> updateCreditById(@RequestBody UserCredit userCredit){
        userCreditService.updateById(userCredit);
        return Result.ok(userCredit);
    }
}
